######DEFAULT######
/*
* 本文件内容不要人为修改，本文件由"python3 Christmas.py Input/MergeCode/LinkModule"生成
* 如果再次运行生成脚本，人为修改的代码将被删除
* 全局Gradle配置修改Christmas/Template/LinkModule/Gradle.templ
* 模块依赖设置请修改src/main/java/com/stoprefactoring/once/module/??/Once.Link
* 修改结束后，终端执行"python3 Christmas.py Input/MergeCode/LinkModule"重新生成此文件
*
* The contents of this file should not be modified. This file is generated by "python3 Christmas.py Input/MergeCode/LinkModule"
* If the generation script is run again, the artificially modified code will be deleted
* Global Gradle settings, please modify Christmas/Template/LinkModule/Gradle.templ
* Module Dependencies settings, please modify src/main/java/com/stoprefactoring/once/module/??/Once.Link
* After the modification, execute "python3 Christmas.py Input/MergeCode/LinkModule" in the terminal to regenerate this file.
*/
plugins {
	id 'java'
	id 'war'
	id 'org.springframework.boot' version '3.3.1'
	id 'io.spring.dependency-management' version '1.1.5'
}

group = 'com.stoprefactoring'
version = ''

java {
	sourceCompatibility = '21'
}

repositories {
	mavenCentral()
	maven {url 'https://maven.aliyun.com/repository/public'}
}

tasks.named('test') {
	useJUnitPlatform()
}

configurations {
	providedRuntime

	// remove default logger
    all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
sourceSets {
	main {
		resources {
			srcDir 'config'
		}
		java{
			if(!project.hasProperty('module')){
				exclude '**/module/*/Sample.java'
			} else {
				if(!file("src/main/java/com/stoprefactoring/once/module/${project.property('module').toString()}/${project.property('module').toString()}.java").exists() ||
				   !file("src/main/java/com/stoprefactoring/once/module/${project.property('module').toString()}/Sample.java").exists()){
					throw new GradleException("!!!Error: Module '${project.property('module').toString()}' does not exist.")
				}
				include 'com/stoprefactoring/once/module/Module.java'
				include 'com/stoprefactoring/once/module/Link.java'
				include 'com/stoprefactoring/once/common/**/*.java'
				include 'com/stoprefactoring/once/OnceApplication.java'
				include 'com/stoprefactoring/once/ServletInitializer.java'
				include "com/stoprefactoring/once/module/${project.property('module').toString()}/*.java"
			}
		}
	}
}

dependencies {
	implementation('org.springframework.boot:spring-boot-starter-web') {
		exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
	}
	providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

	//Common
	implementation 'commons-lang:commons-lang:2.6'
	implementation 'org.mockito:mockito-core'
	implementation 'com.alibaba.fastjson2:fastjson2:2.0.50'
	implementation 'org.springframework.boot:spring-boot-autoconfigure'
	implementation 'org.springframework.boot:spring-boot-starter-log4j2'
    
    @@include@@

}
######DEFAULT######

######MODULE-INCLUDE######
######MODULE-INCLUDE######